package com.yeren.inerator;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class IneratorDemo {

	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
		list.add("one");
		list.add("two");
		list.add("three");
		list.add("four");
		
		Iterator<String> it=list.iterator();
		it.next();
		it.remove();
//		it.remove();//首先要获得元素（调用it.next）,调用remove之前没有调用next将是非法的。
		
		while(it.hasNext()){
			System.out.println(it.next());
		}
	}

}
